Select file(s) using OpenFileDialog

C# .NET

public static string DoTest()
{
         System.Windows.Forms.OpenFileDialog         openFileDialog1 = new OpenFileDialog();
         openFileDialog1.InitialDirectory = "c:\\" ;
         openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
         openFileDialog1.FilterIndex = 1 ;
         openFileDialog1.RestoreDirectory = true ;
         openFileDialog1.Multiselect = true;
         String strRet = "Selected Files(s):\r\n";
         if(openFileDialog1.ShowDialog() == DialogResult.OK)
         {
                  foreach(String strFileName in openFileDialog1.FileNames)
                  {
                           strRet += (strFileName + "\r\n");
                  }
         }
         return strRet;
}

 

Blaze++ .NET

static String DoTest()
{
         System::Windows::Forms::OpenFileDialog         openFileDialog1;
         openFileDialog1.InitialDirectory = "c:\\" ;
         openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
         openFileDialog1.FilterIndex = 1 ;
         openFileDialog1.RestoreDirectory = true ;
         openFileDialog1.Multiselect = true;
         String strRet = "Selected Files(s):\r\n";



         if(openFileDialog1.ShowDialog() == DialogResult::OK)
         {
                  foreach(String, strFileName, openFileDialog1.FileNames)
                  {
                           strRet += (strFileName + "\r\n");
                  }
         }
         return strRet;
}